package com.demo.controller;

import com.demo.entity.Course;
import com.demo.service.CourseServiceV3;
import com.demo.service.CourseServiceV4;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by IntelliJ IDEA.
 * User: bj910
 * Date:2023-08-07
 * Time: 23:12
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("/ds4")
public class CourseControllerV4 {

    @Autowired
    CourseServiceV4 courseService;

    @ResponseBody
    @RequestMapping("/sessionTest")
    public Object queryCourse(@RequestParam(value = "key",defaultValue = "write") String key, HttpServletRequest request){
        request.getSession().setAttribute("rw",key);
        return courseService.selectCourse();
    }
}
